package cn.npe.di.config;

import cn.npe.di.handler.InvokeHandler;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

import java.util.List;
/**
 * @ClassName AutoConfigurationImportSelector
 * @Author zhjx
 * @Description 这里面指定的类会在所有的配置类处理完后再处理
 * @Date 2024/5/17 17:45
 **/
public class AutoConfigurationImportSelector implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        List<String> invokeHandlerclassNames = SpringFactoriesLoader.loadFactoryNames(InvokeHandler.class, ClassUtils.getDefaultClassLoader());
        return StringUtils.toStringArray(invokeHandlerclassNames);
    }
}
